const mch_id = '1612655641' //商户号
const env_id = 'myaudio-3gbiqrxk8c6bd975' //环境Id
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数


exports.main = async (event, context) => {
  console.log(event)
  const res = await cloud.cloudPay.unifiedOrder({
    'body': '声浪配音-会员充值',
    'subMchId': mch_id,
    'envId': env_id,
    'totalFee': parseInt(event.money),
    'nonceStr': event.nonceStr,
    'outTradeNo': event.outTradeNo,
    'spbillCreateIp': '127.0.0.1',
    'tradeType': 'JSAPI',
    'functionName': 'wxPayCallback'
  })
  return res
}